package com.syh.jn.scm.infrastructure.repository.impl.operation.system;

import cn.redscarf.commons.wrapper.Wrapper;
import com.syh.core.ddd.infrastructure.repository.AggregateRepoHibernateImplTmpl;
import com.syh.jn.scm.domain.operation.entity.system.TerminalAccount;
import com.syh.jn.scm.domain.operation.entity.system.TerminalAccountOfPhone;
import com.syh.jn.scm.domain.operation.repository.system.TerminalAccountOfPhoneRepository;
import com.syh.jn.scm.dto.operation.system.TerminaAccountOfPhone.TerminalAccountVo;
import com.syh.jn.scm.infrastructure.repository.model.system.AccountModel;
import com.syh.jn.scm.infrastructure.repository.model.system.AccountOfPhoneModel;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.stereotype.Repository;

import java.util.Collections;
import java.util.List;

/**
 * Created by soci.song on 2018/12/13.
 */
@Log
@Repository
public class TerminalAccountOfPhoneRepositoryImpl implements TerminalAccountOfPhoneRepository {

  private AggregateRepoHibernateImplTmpl<TerminalAccountOfPhone, AccountOfPhoneModel, Long> accountOfPhoneHibernateImpl;

  private AggregateRepoHibernateImplTmpl<TerminalAccount, AccountModel, Long> accountHibernateImpl;

  @Autowired
  public TerminalAccountOfPhoneRepositoryImpl(HibernateTemplate hibernateTemplate) {
    this.accountOfPhoneHibernateImpl = new AggregateRepoHibernateImplTmpl.Builder().hibernateTemplate(hibernateTemplate)
            .entityClass(TerminalAccountOfPhone.class).modelClass(AccountOfPhoneModel.class).idClass(Long.class).build();
    this.accountHibernateImpl = new AggregateRepoHibernateImplTmpl.Builder().hibernateTemplate(hibernateTemplate)
            .entityClass(TerminalAccount.class).modelClass(AccountModel.class).idClass(Long.class).build();
  }


  @Override
  public void update(TerminalAccountOfPhone entity) {
    accountOfPhoneHibernateImpl.update(entity);
  }

  @Override
  public void removeById(Long id) {
    accountOfPhoneHibernateImpl.removeById(id);
  }

  @Override
  public void remove(TerminalAccountOfPhone entity) {
    accountOfPhoneHibernateImpl.remove(entity);
  }

  @Override
  public TerminalAccountOfPhone getById(Long id) {
    return accountOfPhoneHibernateImpl.getById(id);
  }

  @Override
  public TerminalAccountOfPhone getOne(Wrapper wrapper) {
    return accountOfPhoneHibernateImpl.getOne(wrapper);
  }

  @Override
  public List<TerminalAccountOfPhone> getList(Wrapper wrapper) {
    return accountOfPhoneHibernateImpl.getList(wrapper);
  }

  @Override
  public List<TerminalAccountOfPhone> findListPage(Wrapper wrapper, Integer startRow, Integer count) {
    return accountOfPhoneHibernateImpl.findListPage(wrapper, startRow, count);
  }

  @Override
  public int getCount(Wrapper wrapper) {
    return accountOfPhoneHibernateImpl.getCount(wrapper);
  }

  @Override
  public boolean contains(Long aLong) {
    return accountOfPhoneHibernateImpl.contains(aLong);
  }

  @Override
  public void updateAccount(TerminalAccount account) {
    this.accountHibernateImpl.update(account);
  }

  @Override
  public TerminalAccount getAccountById(Long id) {
    return this.accountHibernateImpl.getById(id);
  }

  @Override
  public List<TerminalAccount> getAccountList(Wrapper wrapper) {
    return this.accountHibernateImpl.getList(wrapper);
  }

  @Override
  public List<TerminalAccountVo> getAccountVoList(Wrapper wrapper) {
    log.warning("该接口暂不实现");
    return Collections.EMPTY_LIST;
  }

  @Override
  public List<TerminalAccountVo> findAccountListPage(Wrapper wrapper, int startRow, int pageCount) {
    log.warning("该接口暂不实现");
    return Collections.EMPTY_LIST;
  }

  @Override
  public int getAccountCount(Wrapper wrapper) {
    log.warning("该接口暂不实现");
    return 0;
  }

}
